//
// Created by lihengliu on 2023/2/26.
//
#include "jni_int_util.h"

jclass JNIIntUtil::createIntegerClass(JNIEnv *env) {
    return env->FindClass("java/lang/Integer");
}

jobject JNIIntUtil::createIntegerInstanceOfInt(JNIEnv *env) {
    jclass class_int = createIntegerClass(env);
    jmethodID init_int = env->GetMethodID(class_int, "<init>", "(I)V");
    jobject obj_int = env->NewObject(class_int, init_int);
    return obj_int;
}

jobject JNIIntUtil::createIntegerInstanceOfInt(JNIEnv *env, jclass class_int) {
    jmethodID init_int = env->GetMethodID(class_int, "<init>", "(I)V");
    jobject obj_int = env->NewObject(class_int, init_int);
    return obj_int;
}

jmethodID JNIIntUtil::createIntegerConstructorOfInt(JNIEnv *env) {
    jclass class_int = createIntegerClass(env);
    jmethodID init_int = env->GetMethodID(class_int, "<init>", "(I)V");
    return init_int;
}


jmethodID JNIIntUtil::createIntegerConstructorOfInt(JNIEnv *env,jclass class_int) {
    jmethodID init_int = env->GetMethodID(class_int, "<init>", "(I)V");
    return init_int;
}

jmethodID JNIIntUtil::createIntegerIntValueMethod(JNIEnv *env) {
    jclass class_int = createIntegerClass(env);
    jmethodID method_int = env->GetMethodID(class_int, "intValue", "()I");
    return method_int;
}

jmethodID JNIIntUtil::createIntegerIntValueMethod(JNIEnv *env, jclass class_int) {
    jmethodID method_int = env->GetMethodID(class_int, "intValue", "()I");
    return method_int;
}
